home *** CD-ROM | disk | FTP | other *** search
Wrap
function Swarmer() { } function Pod() { } function Bomber() { } function Baiter() { } function Mutant() { } function Lander() { } function Man() { } _root.tip_array = new Array("Tip: Press \'P\' to pause the game and access the menu whilst the game is playing.","Tip: Press \'S\' to activate the smart bomb and destroy everything on the screen (you have limited bombs).","Tip: Press \'D\' to activate hyperspace and get out of trouble (you have unlimited hyperspaces).","Tip: Keep an eye on the radar for alien abductions. If they get to the top they become mutants.","Tip: Press and hold down the \'A\' button for constant fire.","Tip: Catch falling comrades mid-air and land them safely for maximum points."); _root.extra_points = 7500; _root.extra_bombs = 5000; _root.enemies_to_kill = 10; _root.max_enemies = 10; _root.en_shot_speed = 1; _root.en_appear_time = 15; _root.sound_on = true; _root.splash_music = new Sound(this); _root.splash_music.attachSound("splash_music"); _root.extra_life_sfx = new Sound(this); _root.extra_life_sfx.attachSound("extra_life_sfx"); _root.blast_sfx = new Sound(this); _root.blast_sfx.attachSound("blast_sfx"); _root.hyperjump = new Sound(this); _root.hyperjump.attachSound("hyper_sfx"); _root.ship_appear = new Sound(); _root.ship_appear.attachSound("ship_appear_sfx"); _root.en_shot_sfx = new Sound(); _root.en_shot_sfx.attachSound("enemy_shot_sfx"); _root.pl_shot_sfx = new Sound(); _root.pl_shot_sfx.attachSound("pl_shot_sfx"); _root.smart_sfx = new Sound(); _root.smart_sfx.attachSound("smart_bomb_sfx"); _root.man_captured_sfx = new Sound(); _root.man_captured_sfx.attachSound("man_captured_sfx"); _root.man_taken_sfx = new Sound(); _root.man_taken_sfx.attachSound("man_taken_sfx"); Swarmer.prototype = new MovieClip(); Swarmer.prototype.onLoad = function() { _root.enemies_on += 1; _root.locator.attachMovie("radar_dot",this._name,Number(this._name.slice(5)) + 30); eval("_root.locator." + this._name).gotoAndStop(7); if(this.dx < 0) { this._xscale = -100; } }; Swarmer.prototype.Destroy = function() { removeMovieClip(eval("_root.locator." + this._name)); _root.AttachBang(this._x,this._y); _root.Scoring(this._x,this._y,150); _root.CheckLevelFin(); removeMovieClip(this); }; Swarmer.prototype.onEnterFrame = function() { var _loc1_ = this; var _loc2_ = _root; if(_loc2_.player_on && !_loc2_.paused) { if(_loc1_.hitTest(_loc2_.ship_0.hot_spot_en)) { _loc2_.PlayerHitted(); } if(Math.random() < 0.02 * _loc2_.en_shooting) { _loc2_.EnShooting(_loc1_.x,_loc1_._y,_loc1_._x); } _loc1_.y1 = _loc1_._y + _loc1_.dy * _loc2_.enemy_speed; if(_loc1_.y1 > 330 || _loc1_.y1 < 80 || Math.random() < 0.01) { _loc1_.dy = - _loc1_.dy; } else { _loc1_._y = _loc1_.y1; } _loc1_.x = _loc2_.ToNewX(_loc1_.x,_loc1_.dx * _loc2_.enemy_speed); _loc1_._x = _loc2_.ToGlobal(_loc1_.x); } }; Object.registerClass("swarmer",Swarmer); Pod.prototype = new MovieClip(); Pod.prototype.onLoad = function() { _root.enemies_on += 1; _root.locator.attachMovie("radar_dot",this._name,Number(this._name.slice(5)) + 30); eval("_root.locator." + this._name).gotoAndStop(6); this.dx = Math.random() >= 0.5 ? -4 * _root.enemy_speed : 4 * _root.enemy_speed; this.dy = Math.random() >= 0.5 ? -1 * _root.enemy_speed : 1 * _root.enemy_speed; }; Pod.prototype.Destroy = function(bang) { if(!bang) { this.swarmers = 4; s = 1; while(s < 16) { if(!_root.EnemyAr[s]) { _root.EnemyAr[s] = true; _root.attachMovie("swarmer","ship_" + s,s + 30); this.ship = eval("_root.ship_" + s); this.ship.x = this.x; this.ship._y = this._y; this.ship.dx = this.dx * 1.5; this.ship.dy = (this.swarmers - 3) * 2 + 1; this.swarmers -= 1; if(this.swarmers == 0) { s = 16; } } s++; } } removeMovieClip(eval("_root.locator." + this._name)); _root.AttachBang(this._x,this._y); _root.Scoring(this._x,this._y,1000); _root.CheckLevelFin(); removeMovieClip(this); }; Pod.prototype.onEnterFrame = function() { var _loc1_ = this; var _loc2_ = _root; if(_loc2_.player_on && !_loc2_.paused) { if(_loc1_.hitTest(_loc2_.ship_0.hot_spot_en)) { _loc2_.PlayerHitted(); } if(Math.random() < 0.02 * _loc2_.en_shooting) { _loc2_.EnShooting(_loc1_.x,_loc1_._y,_loc1_._x); } _loc1_.y1 = _loc1_._y + _loc1_.dy; if(_loc1_.y1 > 330 || _loc1_.y1 < 80 || Math.random() < 0.01) { _loc1_.dy = - _loc1_.dy; } else { _loc1_._y = _loc1_.y1; } _loc1_.x = _loc2_.ToNewX(_loc1_.x,_loc1_.dx); _loc1_._x = _loc2_.ToGlobal(_loc1_.x); } }; Object.registerClass("pod",Pod); Bomber.prototype = new MovieClip(); Bomber.prototype.onLoad = function() { _root.enemies_on += 1; _root.locator.attachMovie("radar_dot",this._name,Number(this._name.slice(5)) + 30); eval("_root.locator." + this._name).gotoAndStop(5); this.dx = Math.random() >= 0.5 ? -4 * _root.enemy_speed : 4 * _root.enemy_speed; this.dy = Math.random() >= 0.5 ? -1 * _root.enemy_speed : 1 * _root.enemy_speed; this.timr = 15; this.mines = 4; }; Bomber.prototype.Destroy = function() { removeMovieClip(eval("_root.locator." + this._name)); _root.AttachBang(this._x,this._y); _root.Scoring(this._x,this._y,250); _root.CheckLevelFin(); removeMovieClip(this); }; Bomber.prototype.onEnterFrame = function() { if(_root.player_on && !_root.paused) { if(this.hitTest(_root.ship_0.hot_spot_en)) { _root.PlayerHitted(); } if(this.timr <= 0 && this.mines > 0) { this.timr = 15; this.mines -= 1; if(this._x < 700) { _root.attachMovie("mine","mine_" + _root.mines_count,_root.mines_count); eval("_root.mine_" + _root.mines_count).x = this.x; eval("_root.mine_" + _root.mines_count)._y = this._y; _root.mines_count += 1; if(_root.mines_count == 20) { _root.mines_count = 0; } } } else { this.timr -= 1; } this.y1 = this._y + this.dy; if(this.y1 > 330 || this.y1 < 80) { if(this.mines <= 0) { this.timr = 15; this.mines = 4; } this.dy = - this.dy; } else { this._y = this.y1; } this.x = _root.ToNewX(this.x,this.dx); this._x = _root.ToGlobal(this.x); } }; Object.registerClass("bomber",Bomber); Baiter.prototype = new MovieClip(); Baiter.prototype.onLoad = function() { _root.enemies_on += 1; _root.locator.attachMovie("radar_dot",this._name,Number(this._name.slice(5)) + 30); eval("_root.locator." + this._name).gotoAndStop(4); this.to_x = Math.random() * _root.x_dimension; this.y_init = this._y; this.sinus = 0; }; Baiter.prototype.Destroy = function() { removeMovieClip(eval("_root.locator." + this._name)); _root.AttachBang(this._x,this._y); _root.Scoring(this._x,this._y,200); _root.CheckLevelFin(); removeMovieClip(this); }; Baiter.prototype.onEnterFrame = function() { var _loc1_ = this; var _loc2_ = _root; if(_loc2_.player_on && !_loc2_.paused) { if(_loc1_.hitTest(_loc2_.ship_0.hot_spot_en)) { _loc2_.PlayerHitted(); } _loc1_.distance = _loc1_.to_x - _loc1_.x; if(Math.abs(_loc1_.distance) < 40) { _loc1_.to_x = Math.random() * _loc2_.x_dimension; _loc1_.y_amp = 2 * (Math.random() * 10); } _loc1_.dx = _loc1_.to_x <= _loc1_.x ? -14 * _loc2_.enemy_speed : 14 * _loc2_.enemy_speed; _loc1_.x = _loc2_.ToNewX(_loc1_.x,_loc1_.dx); _loc1_._y = _loc1_.y_init + Math.sin(_loc1_.sinus) * 20 * _loc2_.enemy_speed; _loc1_.sinus += 0.1; _loc1_._x = _loc2_.ToGlobal(_loc1_.x); if(Math.random() < 0.04 * _loc2_.en_shooting) { _loc2_.EnShooting(_loc1_.x,_loc1_._y,_loc1_._x); } } }; Object.registerClass("baiter",Baiter); Mutant.prototype = new MovieClip(); Mutant.prototype.onLoad = function() { _root.enemies_on += 1; _root.locator.attachMovie("radar_dot",this._name,Number(this._name.slice(5)) + 30); eval("_root.locator." + this._name).gotoAndStop(2); this.sinus = 0; }; Mutant.prototype.Destroy = function() { removeMovieClip(eval("_root.locator." + this._name)); _root.AttachBang(this._x,this._y); _root.Scoring(this._x,this._y,150); _root.CheckLevelFin(); removeMovieClip(this); }; Mutant.prototype.onEnterFrame = function() { var _loc1_ = this; var _loc2_ = _root; if(_loc2_.player_on && !_loc2_.paused) { if(_loc1_.hitTest(_loc2_.ship_0.hot_spot_en)) { _loc2_.PlayerHitted(); } _loc1_.x_incr = _loc2_.ship_0._x - _loc1_._x; _loc1_.ang = Math.atan2(_loc2_.ship_0._y - _loc1_._y,_loc1_.x_incr); _loc1_._y += Math.sin(_loc1_.ang) * 8 * _loc2_.enemy_speed + Math.sin(_loc1_.sinus) * 5; _loc1_.sinus += 0.2; _loc1_.dx = Math.cos(_loc1_.ang) * 8 * _loc2_.enemy_speed; if(Math.abs(_loc1_.x_incr) > _loc2_.x_dimension / 2) { _loc1_.dx = - _loc1_.dx; } _loc1_.x = _loc2_.ToNewX(_loc1_.x,_loc1_.dx); _loc1_._x = _loc2_.ToGlobal(_loc1_.x); if(Math.random() < 0.02 * _loc2_.en_shooting) { _loc2_.EnShooting(_loc1_.x,_loc1_._y,_loc1_._x); } } }; Object.registerClass("mutant",Mutant); Lander.prototype = new MovieClip(); Lander.prototype.onLoad = function() { _root.enemies_on += 1; this.action = 0; this.dx = Math.random() >= 0.5 ? 4 * _root.enemy_speed : -4 * _root.enemy_speed; this.dy = (Math.random() * 4 - 2) * _root.enemy_speed; _root.locator.attachMovie("radar_dot",this._name,Number(this._name.slice(5)) + 30); eval("_root.locator." + this._name).gotoAndStop(3); }; Lander.prototype.Destroy = function() { this.victim.action = 2; this.action = 0; _root.ShowMessage(false); removeMovieClip(eval("_root.locator." + this._name)); _root.AttachBang(this._x,this._y); _root.Scoring(this._x,this._y,150); _root.CheckLevelFin(); removeMovieClip(this); }; Lander.prototype.onEnterFrame = function() { if(_root.player_on && !_root.paused) { if(this.hitTest(_root.ship_0.hot_spot_en)) { _root.PlayerHitted(); } switch(this.action) { case 0: this.victim = undefined; this.y1 = this._y + this.dy; if(this.y1 > 80 && this.y1 < 330) { this._y = this.y1; } if(Math.random() < 0.02) { this.dy = (Math.random() * 4 - 2) * _root.enemy_speed; if(Math.random() < 0.5 * _root.en_shooting) { _root.EnShooting(this.x,this._y,this._x); } } if(Math.random() < 0.004 * _root.pick_up_man) { this.ind = Math.floor(Math.random() * 10) + 1; this.victim = eval("_root.man_" + this.ind); if(_root.AstroAr[this.ind] && this.victim.action == 0) { _root.AstroAr[this.ind] = false; this.action = 1; } } this.x = _root.ToNewX(this.x,this.dx); this._x = _root.ToGlobal(this.x); break; case 1: if(Math.random() < 0.01) { _root.EnShooting(this.x,this._y,this._x); } this.ang = Math.atan2(this.victim._y - 15 - this._y,this.victim.x - this.x); this._y += Math.sin(this.ang) * 4 * _root.enemy_speed; this.dx = Math.cos(this.ang) * 4 * _root.enemy_speed; if(this.victim.action != 0) { this.action = 0; } if(this.hitTest(this.victim)) { _root.ShowMessage(true); this.action = 2; this.victim.action = 1; this.victim.x = this.x; if(_root.sound_on) { _root.man_captured_sfx.start(0,1); } } this.x = _root.ToNewX(this.x,this.dx); this._x = _root.ToGlobal(this.x); break; case 2: this.x = _root.ToNewX(this.x,0); this._x = _root.ToGlobal(this.x); this._y -= 2 * _root.enemy_speed; if(this.victim._y < 20) { this.action = 0; _root.ShowMessage(false); this.dx = Math.random() >= 0.5 ? 4 * _root.enemy_speed : -4 * _root.enemy_speed; } if(this._y <= 80) { removeMovieClip(eval("_root.locator." + this._name)); this.victim.Destroy(); _root.EnemyAr[Number(this._name.slice(5))] = false; _root.enemies_on -= 1; _root.EnemyAttach(2,false,this.x,this._y); this.action = 0; _root.ShowMessage(false); removeMovieClip(this); } } } }; Object.registerClass("lander",Lander); Man.prototype = new MovieClip(); Man.prototype.Destroy = function() { if(this.action == 1) { _root.ShowMessage(false); } _root.max_astronauts -= 1; _root.astronauts -= 1; if(_root.astronauts <= 0) { _root.PlanetDestroy(); } removeMovieClip(eval("_root.locator." + this._name)); _root.AttachBang(this._x,this._y); removeMovieClip(this); }; Man.prototype.onLoad = function() { _root.astronauts += 1; this.action = 0; this.gotoAndPlay(Math.floor(Math.random() * 26)); if(Math.random() < 0.5) { this.dx = -0.3; } else { this.dx = 0.3; this._xscale = -100; } this._y = 370; this.x = Math.random() * _root.x_dimension; _root.locator.attachMovie("radar_dot",this._name,2 + Number(this._name.slice(4))); eval("_root.locator." + this._name).gotoAndStop(8); }; Man.prototype.onEnterFrame = function() { var _loc1_ = this; var _loc2_ = _root; if(!_loc2_.paused) { switch(_loc1_.action) { case 0: if(_loc2_.player_on) { _loc1_.x = _loc2_.ToNewX(_loc1_.x,_loc1_.dx); } _loc1_._x = _loc2_.ToGlobal(_loc1_.x); _loc1_.fall_from = 300; break; case 1: if(_loc2_.player_on) { _loc1_.x = _loc2_.ToNewX(_loc1_.x,0); _loc1_._x = _loc2_.ToGlobal(_loc1_.x); _loc1_._y -= 2 * _loc2_.enemy_speed; _loc1_.fall_from = _loc1_._y; _loc1_.dy = 0; } break; case 2: if(_loc2_.player_on) { _loc1_.x = _loc2_.ToNewX(_loc1_.x,0); _loc1_._x = _loc2_.ToGlobal(_loc1_.x); _loc1_._y += _loc1_.dy; _loc1_.dy += 0.05; if(_loc1_.hitTest(_loc2_.ship_0)) { _loc2_.Scoring(_loc1_._x,_loc1_._y,500); _loc1_.action = 3; if(_loc2_.sound_on) { _loc2_.man_taken_sfx.start(0,1); } } if(_loc1_._y >= 370) { if(_loc1_.fall_from < 260) { _loc1_.Destroy(); } _loc2_.Scoring(_loc1_._x,_loc1_._y,250); _loc1_._y = 370; _loc1_.action = 0; _loc2_.AstroAr[Number(_loc1_._name.slice(4))] = true; } } break; case 3: if(_loc2_.player_on) { _loc1_.x = _loc2_.ship_x + _loc2_.ship_0._x; _loc1_._x = _loc2_.ship_0._x; _loc1_._y = _loc2_.ship_0._y + 15; if(_loc1_._y >= 365) { _loc2_.Scoring(_loc1_._x,_loc1_._y,500); _loc1_._y = 370; _loc1_.action = 0; _loc2_.AstroAr[Number(_loc1_._name.slice(4))] = true; } } } } }; Object.registerClass("man",Man);